#pragma warning disable 108
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using Cephei;
using Cephei.Generic;
using Cephei.QL.Times;
using Cephei.QL.Instruments.Bonds;
using Cephei.QL.Termstructures;
using Cephei.QL;
namespace Cephei.QL.Instruments
{
     // <summary> 
	// ! 1. valueDate refers to the settlement date of the bond forward contract.  maturityDate is the delivery (or repurchase) date for the underlying bond (not the bond's maturity date).  2. Relevant formulas used in the calculations (\f$P\f$ refers to a price):  a. \f$ P_{CleanFwd}(t) = P_{DirtyFwd}(t) - AI(t=deliveryDate) \f$ where \f$ AI \f$ refers to the accrued interest on the underlying bond.  b. \f$ P_{DirtyFwd}(t) = \frac{P_{DirtySpot}(t) - SpotIncome(t)} {discountCurve->discount(t=deliveryDate)} \f$  c. \f$ SpotIncome(t) = \sum_i \left( CF_i \times incomeDiscountCurve->discount(t_i) \right) \f$ where \f$ CF_i \f$ represents the ith bond cash flow (coupon payment) associated with the underlying bond falling between the settlementDate and the deliveryDate. (Note the two different discount curves used in b. and c.) 
	// <b>Example: </b> \link Repo.cpp valuation of a repo on a fixed-rate bond \endlink  \todo Add preconditions and tests  \todo Create switch- if coupon goes to seller is toggled on, don't consider income in the \f$ P_{DirtyFwd}(t) \f$ calculation.  \todo Verify this works when the underlying is paper (in which case ignore all AI.)  \warning This class still needs to be rigorously tested  \ingroup instruments
	// </summary>
    [Guid ("6A100769-AF28-4500-8E60-FFE0E33798E7"),ComVisible(true)]
	public interface IFixedRateBondForward : Cephei.QL.Instruments.IForward
	{
		///////////////////////////////////////////////////////////////
        // Methods
        //
        
		 Double CleanForwardPrice {get;}
        
		 Double ForwardPrice {get;}
        
		 Double SpotIncome(Cephei.QL.Termstructures.IYieldTermStructure incomeDiscountCurve);
        
		 Double SpotValue {get;}
    }

    // <summary> 
	// ! 1. valueDate refers to the settlement date of the bond forward contract.  maturityDate is the delivery (or repurchase) date for the underlying bond (not the bond's maturity date).  2. Relevant formulas used in the calculations (\f$P\f$ refers to a price):  a. \f$ P_{CleanFwd}(t) = P_{DirtyFwd}(t) - AI(t=deliveryDate) \f$ where \f$ AI \f$ refers to the accrued interest on the underlying bond.  b. \f$ P_{DirtyFwd}(t) = \frac{P_{DirtySpot}(t) - SpotIncome(t)} {discountCurve->discount(t=deliveryDate)} \f$  c. \f$ SpotIncome(t) = \sum_i \left( CF_i \times incomeDiscountCurve->discount(t_i) \right) \f$ where \f$ CF_i \f$ represents the ith bond cash flow (coupon payment) associated with the underlying bond falling between the settlementDate and the deliveryDate. (Note the two different discount curves used in b. and c.) 
	// <b>Example: </b> \link Repo.cpp valuation of a repo on a fixed-rate bond \endlink  \todo Add preconditions and tests  \todo Create switch- if coupon goes to seller is toggled on, don't consider income in the \f$ P_{DirtyFwd}(t) \f$ calculation.  \todo Verify this works when the underlying is paper (in which case ignore all AI.)  \warning This class still needs to be rigorously tested  \ingroup instruments Factory
	// </summary>
   	[ComVisible(true)]
    public interface IFixedRateBondForward_Factory // : Collection_Factory<IFixedRateBondForward, ICell<IFixedRateBondForward>>
    {
        ///////////////////////////////////////////////////////////////
        // Factory methods
        //
        
	    IFixedRateBondForward Create (DateTime valueDate, DateTime maturityDate, QL.Position.TypeEnum type, Double strike, UInt32 settlementDays, Cephei.QL.Times.IDayCounter dayCounter, Cephei.QL.Times.ICalendar calendar, QL.Times.BusinessDayConventionEnum businessDayConvention, Cephei.QL.Instruments.Bonds.IFixedRateBond fixedCouponBond, Microsoft.FSharp.Core.FSharpOption<Cephei.QL.Termstructures.IYieldTermStructure> discountCurve, Microsoft.FSharp.Core.FSharpOption<Cephei.QL.Termstructures.IYieldTermStructure> incomeDiscountCurve, Cephei.QL.IPricingEngine QL_Pricer);
    }
}

